package com.study.leetcode;

import java.util.Arrays;

//https://leetcode-cn.com/problems/minimize-maximum-pair-sum-in-array/
public class Solution_1877 {
    public int minPairSum(int[] nums) {
        Arrays.sort(nums);
        int max = 0;
        //越接近平均数越小
        for (int i = 0, j = nums.length - 1; i < j; i++, j--) {
            max = Math.max(max, nums[i] + nums[j]);
        }
        return max;
    }
}
